require 'rubygems'
require 'rmmseg'
require 'iconv'

RMMSeg::Dictionary.load_dictionaries
RMMSeg::Dictionary.load_words("dict/hidoudou.dic")
RMMSeg::Dictionary.load_words("dict/brands.dic")
RMMSeg::Dictionary.load_words("dict/clothes.dic")
RMMSeg::Dictionary.load_words("dict/star.dic")

if ARGV.size == 1
	algor = RMMSeg::Algorithm.new(ARGV[0])
else
	algor = RMMSeg::Algorithm.new('韩都衣舍韩国欧美风纯色简约短袖连衣裙Q904')
end

loop do
  tok = algor.next_token
  break if tok.nil?
  next if tok.text.length <= 3
  puts "#{tok.text} [#{tok.start}..#{tok.end}]"
end



